/* 
 * File:   map.h
 * Author: Michael
 *
 * Created on September 26, 2010, 3:57 PM
 */

#include <cstdlib>
#include <iostream>
#include <string>

#include <stack>
#include <queue>

using namespace std;

#ifndef MAP_H
#define	MAP_H

struct point{
    unsigned int x;
    unsigned int y;
};
struct tile {
    point location;
    char c;
    bool visited;
    string path;
};

class map{
// OVERVIEW: reads and solves the next room on cin

 private:

     bool useStack;
     stack<tile> stack;
     queue<tile> queue;
     void put(tile t);
     tile get();
     bool isEmpty();

     bool DEBUG;
     unsigned int rows;
     unsigned int columns;
     tile **data;
     point start;
     char exitDirection;

     string Solution;



     void createMap();
     void printMap();

     bool isValidLocation(point p);
     // EFFECTS: returns false if p is not a point contained by map
     //          returns false if p is an invalid tile
     //          true otherwise
     tile visit(point p, string path);
     // EFFECTS: marks location p as visited
     //          Throws invalidTileException if p is an invalid location
     bool visited(point p);
     // EFFECTS: returns true if p was a visited tile false otherwise

     void getExit(tile t, bool &found);
     // EFFECTS: builds solution and updates found

 public:

    map(bool useStack, bool lastRoom, bool debug);
    map(const map &m);
    map &operator=(const map &m);
    ~map();

    string getSolution();
    //EFFECTS: returns solved string

};
class invalidTileException {
    // OVERVIEW: an exception class
};
class cannotCopyException {
    // OVERVIEW: an exception class
};


#endif	/* MAP_H */

